DLW Format
Below is a description to the .dlw file format as used by Dr. Lunatic and Supreme with Cheese, as well as Sleepless Hollow. Please bear in mind a lot of this is still being figured out, so don't expect it to be complete, or accurate. __TOC__ Header Comes right at the start of the file. Tile Data Tile Graphics Tile graphics are partially run-length encoded. Each tile consists of a three-byte "method" value followed by the rows of data. Each bit of the method value specifies whether a certain row of pixels is run-length encoded or flat. Here's some pseudocode (repeat the method for each tile) method = read 3 bytes from file (24 bits) foreach bit in method if bit on use RLE total = 0 while total < 32 runlen = read 1 byte runbyte = read 1 byte set runlen bytes in image to runbyte total += runlen next else read 32 bytes into image end if next Palette Not actually stored in the world file, this is here for reference. As RGB tuples: (To be cleaned-up more nicely) (0,0,0), (8,8,8), (16,16,16), (24,24,24), (32,32,32), (40,40,40), (48,48,48), (56,56,56), (64,64,64), (72,72,72), (80,80,80), (88,88,88), (96,96,96), (104,104,104), (112,112,112), (120,120,120), (128,128,128), (136,136,136), (144,144,144), (152,152,152), (160,160,160), (168,168,168), (176,176,176), (184,184,184), (192,192,192), (200,200,200), (208,208,208), (216,216,216), (228,228,228), (236,236,236), (244,244,244), (252,252,252), (0,0,0), (0,16,0), (0,32,0), (0,48,0), (0,64,0), (0,84,0), (0,100,0), (0,116,0), (0,132,0), (0,148,0), (0,168,0), (0,184,0), (0,200,0), (0,216,0), (0,232,0), (0,252,0), (16,252,16), (32,252,32), (44,252,44), (60,252,60), (76,252,76), (92,252,92), (108,252,108), (124,252,124), (140,252,140), (156,252,156), (172,252,172), (188,252,188), (204,252,204), (220,252,220), (236,252,236), (252,252,252), (0,0,0), (8,4,0), (16,12,4), (28,20,8), (36,24,12), (44,32,16), (56,40,16), (64,44,20), (72,52,24), (84,60,28), (92,64,32), (100,72,32), (112,80,36), (120,84,40), (128,92,44), (140,100,48), (144,108,60), (152,116,72), (160,128,84), (168,136,96), (172,148,112), (180,156,124), (188,164,136), (196,176,148), (200,184,160), (208,192,176), (216,204,188), (224,212,200), (228,224,212), (236,232,224), (244,240,236), (252,252,252), (0,0,0), (0,0,16), (0,0,32), (0,0,48), (0,0,68), (0,0,84), (0,0,100), (0,0,116), (0,0,136), (0,0,152), (0,0,168), (0,0,184), (0,0,204), (0,0,220), (0,0,236), (0,0,252), (16,16,252), (32,32,252), (44,44,252), (60,60,252), (76,76,252), (92,92,252), (108,108,252), (124,124,252), (140,140,252), (156,156,252), (172,172,252), (188,188,252), (204,204,252), (220,220,252), (236,236,252), (252,252,252), (0,0,0), (16,0,0), (32,0,0), (48,0,0), (64,0,0), (84,0,0), (100,0,0), (116,0,0), (132,0,0), (148,0,0), (168,0,0), (184,0,0), (200,0,0), (216,0,0), (232,0,0), (252,0,0), (252,16,16), (252,32,32), (252,44,44), (252,60,60), (252,76,76), (252,92,92), (252,108,108), (252,124,124), (252,140,140), (252,156,156), (252,172,172), (252,188,188), (252,204,204), (252,220,220), (252,236,236), (252,252,252), (0,0,0), (16,16,0), (32,32,0), (48,48,0), (68,68,0), (84,84,0), (100,100,0), (116,116,0), (136,136,0), (152,152,0), (168,168,0), (184,184,0), (204,204,0), (220,220,0), (236,236,0), (252,252,0), (252,252,16), (252,252,32), (252,252,44), (252,252,60), (252,252,76), (252,252,92), (252,252,108), (252,252,124), (252,252,140), (252,252,156), (252,252,172), (252,252,188), (252,252,204), (252,252,220), (252,252,236), (252,252,252), (0,0,0), (16,0,16), (32,0,32), (48,0,48), (68,0,68), (84,0,84), (100,0,100), (116,0,116), (136,0,136), (152,0,152), (168,0,168), (184,0,184), (204,0,204), (220,0,220), (236,0,236), (252,0,252), (252,16,252), (252,32,252), (252,44,252), (252,60,252), (252,76,252), (252,92,252), (252,108,252), (252,124,252), (252,140,252), (252,156,252), (252,172,252), (252,188,252), (252,204,252), (252,220,252), (252,236,252), (252,252,252), (0,0,0), (0,16,16), (0,32,32), (0,48,48), (0,68,68), (0,84,84), (0,100,100), (0,116,116), (0,136,136), (0,152,152), (0,168,168), (0,184,184), (0,204,204), (0,220,220), (0,236,236), (0,252,252), (16,252,252), (32,252,252), (44,252,252), (60,252,252), (76,252,252), (92,252,252), (108,252,252), (124,252,252), (140,252,252), (156,252,252), (172,252,252), (188,252,252), (204,252,252), (220,252,252), (236,252,252), (252,252,252) Tile Metadata After all the tile image data comes the tile metadata. 4 bytes are used for each tile. Flags are represented in the order they appear in the editor: Level Chunks After the header, tile graphics, and metadata, there are several level chunks, one for each level. Level Header Monsters Specials See also: Specials, the hex-editing way by Sokko (most of this information comes from there) "Parameter" byte values Triggers: Boolean mode: * 0 - OR with next trigger * 1 - NOT this trigger * 2 - AND with next trigger * 3 - NOT this trigger and AND with next trigger Exactly/Others mode: * 0 - Exactly * 4 - Or Less or No Monsters * 8 - Or More Any/Good/Evil mode: * 0 - Any * 4 - Good * 8 - Evil Awake/Asleep mode: * 0 - Some Awake * 4 - All Awake * 8 - All Asleep Keypress mode: * 0 - Is Holding * 4 - Taps * 8 - Releases Effects: Temporary/Permanent mode: * 0 - Temporary * 1 - Permanent Current/Max Life * 0 - Current Life * 1 - Max Life Single/Touching/All Same mode: * 0 - Single Tile/Item * 1 - Touching Tiles/Items * 2 - All Same Tiles/Items Target/Player/Tagged * 0 - Target * 1 - Player * 2 - Tagged Change/Toggle, Copy/Swap * 0 - Change or Copy * 4 - Toggle or Swap Play effects mode: * 0 - Play FX or Play Snd * 8 - No FX or No Snd Monster IDs * ??000000 - Normal monster ID * FFFFFFFF - Goodguy * FEFFFFFF - Badguy * FDFFFFFF - Anybody * FCFFFFFF - Non-player * FBFFFFFF - Tagged * FAFFFFFF - Player Variable IDs * 0 - G0 * 1 - G1 * 2 - G2 * 3 - G3 * 4 - G4 * 5 - G5 * 6 - G6 * 7 - G7 * 8 - V0 * 9 - V1 * 10 - V2 * 11 - V3 * 12 - V4 * 13 - V5 * 14 - V6 * 15 - V7 Location As Index Four bytes: * Bottom-right X * Bottom-right Y * Zero * Zero |style="padding: .3em .7em .4em; border: 3px solid #b9ffb9; color: #000; background-color: #f3fff3" width="33%"| Trigger types and data 0. Unused 1. Step On/Near * Location: center point * Index 1: monster type (see left) * Index 2: radius 2. Step In Rect * Location: top-left * Index 1: monster type (see left) * Index 2: bottom-right (see left) 3. Have Item * Index 1: item type * Index 2: item count (Little Endian) * Parameter: Exactly/Or Less/Or More 4. Shoot Item/Wall * Location: center point * Parameter: Any/Good/Evil 5. Monsters Alive * Index 1: monster type (see left) * Index 2: monster count (Little Endian) * Parameter: Exactly/Or Less/Or More 6. Kill Monster * Index 1: monster type (see left) 7. Floor Is Tile * Location: tile location * Index 1: tile type 8. Passed Levels * Index 1: number of levels (Little Endian) * Parameter: Exactly/Or Less/Or More 9. Passed Level * Index 1: level ID 10. Variable * Index 1: variable ID (see left) * Parameter: Exactly/Or Less/Or More 11. Timed * Index 1: every X frames (30/sec) * Index 2: after X frames (30/sec) 12. Delayed * Index 1: after X frames (30/sec) 13. Random * Index 1: percentage (first byte is fractional part so that 256 = 1, second byte is whole part) 14. Chain Off Other * Location: location of special (255,255 for "any adjacent") 15. Tiles In Rect * Location: top-left * Index 1: tile type * Index 2: bottom-right (see left) 16. Monster Life * Location: location (255,y for "Anywhere") * Index 1: monster type (see left) * Index 2: life amount * Parameter: Exactly/Or Less/Or More 17. Step On Tile * Index 1: monster type (see left) * Index 2: tile type 18. Get Item At * Location: location 19. Item On Map * Location: location * Index 1: item type 20. Monster Awake * Location: location (255,y for "Anywhere") * Index 1: monster type (see left) * Parameter: Awake/Asleep 21. Item In Level * Index 1: item type * Index 2: count (Little Endian) * Parameter: Exactly/Or Less/Or More 22. Compare Areas * Location: top-left * Index 1: second top-left (see left) * Index 2: bottom-right (see left) * Parameter: Exactly/No Monsters 23. Compare Vars * Index 1: first variable ID (see left) * Index 2: second variable ID (see left) * Parameter: Exactly/Or Less/Or More 24. Monster In Rect * Location: top-left * Index 1: monster type (see left) * Index 2: bottom-right (see left) 25. Item In Rect * Location: top-left * Index 1: item type * Index 2: bottom-right (see left) 26. Difficulty * Index 1: 0 for Normal, 1 for Hard, 2 for Lunatic * Parameter: Exactly/Or Less/Or More 27. Keypress * Index 1: 1-6: Up, Down, Left, Right, Fire, Special * Parameter: Is Holding/Taps/Releases 28. Playing As * Index 1: 0-4: Bouapha, HSM, Dr. L, Shtupid Shroom, Lunachick 29. Monster Color * Location: location (255, y for "Anywhere") * Index 1: monster type (see left) * Index 2: color, 0-7: gray, green, brown, blue, red, yellow, pink, aqua 30. Equation * Index 1: value * Parameter: Exactly/Or Less/Or More * Uses effect String 31. Var Equation * Index 1: variable ID (see left) * Parameter: Exactly/Or Less/Or More * Uses effect String |style="padding: .3em .7em .4em; border: 3px solid #ffa9a9; color: #000; background-color: #ffe3e3" width="34%"| Effect types and data 0. Unused (needed for the Equation triggers) 1. Message * String: message to display * Parameter: Play Snd/No Snd 2. Play Sound * Index 1: sound ID 3. Play Song * String: song filename 4. Win Level * Location: destination (255,y for "AUTO") * Index 1: level ID 5. Goto Level * Location: destination (255,y for "AUTO") * Index 1: level ID 6. Teleport * Location: destination * Parameter: Target/Player/Tagged * Parameter: Play FX/No FX 7. Change Tiles * Location: destination * Index 1: tile type * Parameter: Change/Toggle * Parameter: Single/Touching/All Same * Parameter: Play FX/No FX 8. Summon Monster * Location: destination * Index 1: monster type (see left) * Index 2: item type (0 for None, 255 for Random) * Parameter: Play FX/No FX 9. Make Light * Location: destination * Index 1: brightness (Little Endian) * Index 2: radius (Little Endian) * Parameter: Temporary/Permanent * Parameter: Play FX/No FX 10. Show Pic/Movie * Index 1: mode (0 for Standard, 1 for Yerfdog, 2 for Computer) * String: filename to display * Parameter: Play FX/No FX 11. Change Item * Index 1: item type * Parameter: Change/Toggle * Parameter: Single/Touching/All Same * Parameter: Play FX/No FX 12. Copy Map * Location: top-left * Index 1: bottom-right (see left) * Index 2: destination top/left * Parameter: Copy/Swap 13. Kill Monsters * Location: location (255,y for "Anywhere") * Index 1: monster type (see left) * Parameter: Play FX/No FX 14. Change Monsters * Location: location (255,y for "Anywhere") * Index 1: "From" monster type (see left) * Index 2: "To" monster type * Parameter: Play FX/No FX 15. Change Teams * Location: location (255,y for "Anywhere") * Index 1: monster type (see left) * Index 2: destination team (0 for Good, 1 for Evil, 2 for Toggle) * Parameter: Play FX/No FX 16. Delete Special * Location: location of special 17. Set Variable * Index 1: variable ID (see left) * String: equation 18. Light Rect * Location: top-left * Index 1: bottom-right (see left) * Index 2: brightness (Little Endian) * Parameter: Temporary/Permanent * Parameter: Play FX/No FX 19. Level Flags * Index 1: flag (0-9, same order as editor) * Index 2: value (0 for "On", 1 for "Off") 20. Old Toggle * Document me! 21. Set Life * Location: monster location (255,y for "Anywhere") * Index 1: monster type (see left) * Index 2: life amount (Little Endian) * Parameter: Current/Max Life * Parameter: Play FX/No FX 22. Force Weapon * Index 1: weapon type (see left) * Index 2: reload if same (0 for "don't", 1 for "do") 23. Tag Target 24. Tag Monster * Location: monster location (255,y for "Anywhere") * Index 1: monster type (see left) 25. Monster Item * Location: monster location (255,y for "Anywhere") * Index 1: monster type (see left) * Index 2: item type * Parameter: Play FX/No FX 26. Tile Var * Location: tile location * Index 1: variable ID (see left) * Parameter: Single/Touching/All Same * Parameter: Play FX/No FX 27. Change Life * Location: monster location (255,y for "Anywhere") * Index 1: monster type (see left) * Index 2: life change amount (Little Endian) * Parameter: Play FX/No FX 28. Monster AI * Location: monster location (255,y for "Anywhere") * Index 1: monster type (see left) * Index 2: monster type to use AI of * Parameter: Play FX/No FX 29. Monster Name * Location: monster location (255,y for "Anywhere") * Index 1: monster type (see left) * String: new name for monster 30. Monster Color * Location: monster location (255,y for "Anywhere") * Index 1: monster type (see left) * Index 2: One byte From color, one byte To color, two null bytes 31. Monster Bright * Location: monster location (255,y for "Anywhere") * Index 1: monster type (see left) * Index 2: brightness (Little Endian) 32. Play As * Index 1: playable character (see Playing As under Triggers) Level Metadata Flags are stored in the order they appear in the editor: Map Data The map data appears to be RLE-encoded, but not as complex as the tile graphics are. The following block is repeated as many times as necessary to fill the entire level: Custom Item Data Items are stored second-last in the file, before custom sounds. Then, for each custom item: Custom Sound Data Custom sound data is last in the file. Then, for each sound: Category:Dr L Technical Information